package com.taomus.mytools.simplec.generate;

import java.io.Serializable;

/**
 * @author mrc
 */
public class Token implements Serializable{
	private static final long serialVersionUID = 1L;
	
	private WordEnum code;
	private String symbol;
	private String alias;
	
	public Token(WordEnum code){
		this(code,code.getSymbol());
	}
	public Token(WordEnum code, String symbol) {
		this(code, symbol, symbol);
	}
	public Token(WordEnum code, String symbol, String alias) {
		super();
		this.code = code;
		this.symbol = symbol;
		this.alias = alias;
	}

	public WordEnum getCode() {
		return code;
	}

	public void setCode(WordEnum code) {
		this.code = code;
	}

	public String getSymbol() {
		return symbol;
	}

	public void setSymbol(String symbol) {
		this.symbol = symbol;
	}

	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}
	@Override
	public String toString() {
		StringBuilder info = new StringBuilder("{");
		info.append(code);
		info.append("=");
		info.append(symbol);
		if(!symbol.equals(alias)){
			info.append(",");
			info.append(alias);
		}
		info.append("}");
		return info.toString();
		//return "Token [code=" + code + ", symbol=" + symbol + ", alias=" + alias + "]";
	}
}
